1. Field of the Invention
Preferred embodiments provide a method, system, program, and data structure for transforming an instruction in a first bit architecture to an instruction in a second bit architecture.
2. Description of the Related Art
Many application programs are written for computers using a 32 bit architecture. However, large scale processing systems are beginning to employ a 64 bit architecture. A 64 bit computing architecture substantially increases the address space, register size, and data structure size that may be used. Further, 64-bit computing provides much faster processing and data transfer than 32 bit. For example, one 64-bit instruction can handle operations that would otherwise take several 32 bit instructions, plus xe2x80x9cclean-upxe2x80x9d code. A 64-bit system can address more memory directly without using complex indexing or register-addressing schemes. Current 64 bit computers include Sun Microsystems Corporation""s Solaris 7 Operating Environment, Compaq Computer Corporation""s AlphaStation 200, as well as other Compaq products using the Alpha 64 bit processor developed by Digital Equipment Corporation, and Intel Corporation""s Merced and Itanium processors, based on the IA-64 architecture, which is the 64 bit architecture promoted by Intel.**
**Solaris is a trademark of Sun Microsystems Corporation; Itanium is a trademark and Merced and IA-64 are code names of Intel Corporation. 
Notwithstanding the benefits of 64 bit computing, many programs are still written using 32 bit instructions. Thus, compiler developers may have to continue supporting 32 bit programs even as the industry moves toward 64 bit architecture computers. To maintain compatibility with existing architectures and compilers (i.e., hide the intricacies from the programmer), compiler developers must incorporate effective intelligence as to when and where to use 64-bit capabilities. Thus, there is a need in the art to develop compilers that are capable of handling both 32 and 64 bit computing to support the transition between 32 -bit and 64-bit architectures.
To overcome the limitations in the prior art described above, preferred embodiments disclose a method, system, program, and data structures for transforming an instruction in a first bit architecture to an instruction in a second bit architecture. Code is transformed from an instruction in the first bit architecture having an operation code and at least one operand. A transform table is accessed including information for transforming the instruction in the first bit architecture to the second bit architecture. The instruction in the first bit architecture is transformed to a corresponding instruction in the second bit architecture if the transform table includes information indicating to modify the instruction in the first bit architecture. The transformation is based on transformation operations that modify the instruction in the first bit architecture to generate the instruction in the second bit architecture.
The first bit architecture may be a 32 bit architecture and the second bit architecture may be a 64 bit architecture.
In further embodiments, the transform table includes one entry for each operation code. The entry for each operation code is capable of including a pointer to an operand table if a transformation is to be performed. No transformation is performed if the entry for the operation code does not include a pointer to one operand table.
The operand table includes an entry for each possible combination of operand bit architecture types. Each entry in the operand table indicates at least one transformation operation. In such case, transforming the instruction involves determining one entry in the operand table having operand bit architecture types that match the bit architecture types of each operand in the instruction in the first bit architecture. At least one transformation operation is then executed to transform the instruction in the first bit architecture to the second bit architecture.
Preferred embodiments provide a technique for transforming instructions from one architecture to another, e.g., 32 bit to 64 bit. With the preferred embodiment technique, the compiler that transforms the code, e.g., intermediate code, to the 32 bit instructions does not have to be modified. Instead, the resulting 32 bit instruction is processed using various tables that provide transformation operations for each operation code type. Preferred embodiments are especially useful for machines that want to support both the 32 bit and 64 bit architectures to allow source programs to be written using 32 bit instructions and data and still operate on the machine.